<?php

$params = require __DIR__ . '/params.php';
$modules = require(__DIR__ . '/modules.php');
$components = require(__DIR__ . '/components.php');

$config = [
    'id'       => 'basic',
    'language' => 'zh-CN',         // 默认语言
    'charset'  => 'utf-8',         // 使用的字符集
    'timeZone' => 'Asia/Shanghai', // 时区

    'basePath'  => dirname(__DIR__),
    'bootstrap' => [
        [
            'class'   => 'yii\filters\ContentNegotiator',
            'formats' => [
                'text/html'        => \yii\web\Response::FORMAT_HTML,
                'application/json' => \yii\web\Response::FORMAT_JSON,
                '*/*'              => \yii\web\Response::FORMAT_HTML,
            ],
        ],
        'log',
    ],

    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
    ],

    'components' => $components, // 组件加载

    'modules' => $modules, // 模块加载
    'params'  => $params,

];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class'      => 'yii\debug\Module',
        'allowedIPs' => ['*'],
        // uncomment the following to add your IP if you are not connecting from localhost.
        //'allowedIPs' => ['127.0.0.1', '::1'],
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class'      => 'yii\gii\Module',
        'allowedIPs' => ['*'],
        // uncomment the following to add your IP if you are not connecting from localhost.
        //'allowedIPs' => ['127.0.0.1', '::1'],
    ];
}

return $config;
